package Test;

import Observer.ConcreteObserver;
import Observer.Observer;
import Subject.Subject;
import Subject.ConcreteSubject;
public class Main {
    public static void main(String[] args) {
        //创建主题和观察者
        Subject subject=new ConcreteSubject();
        Observer observer1=new ConcreteObserver("Observer 1");
        Observer observer2=new ConcreteObserver("Observer 2");
        Observer observer3=new ConcreteObserver("Observer 3");
        subject.addObserver(observer1);
        subject.addObserver(observer2);
        subject.addObserver(observer3);

        subject.notifyObservers("你好");
    }
}
